
import java.util.HashMap;
import java.util.Map;

public class PrintUniqueWordsOfString1 {
	
	public static void main(String[] args) {
		
		String str = "this is the string used to test in white box testing for " +
				"Java practice with case sensitive is use in this  question " +
				"Remember case sensitive is apply for the example" +
				"This one just demo for white box testing class";
		Map<String, Integer> wordFrequencyMap = new HashMap<String, Integer>();
		String delims = "[ ]+";
		String[] tokens = str.split(delims);
 
		for (String word :tokens) {
			int count = wordFrequencyMap.containsKey(word) ? wordFrequencyMap.get(word) : 0;
			wordFrequencyMap.put(word, count + 1);
		}

	    System.out.println("\nUnique words of the string.");
	    for (String word : wordFrequencyMap.keySet()) {
	    	if (wordFrequencyMap.get(word)==1)
	    		System.out.println(word);
		}
	}
}
/* Result
Unique words of the string.
demo
to
apply
test
one
use
Remember
used
Java
exampleThis
question
just
with
class
practice
string
*/

